<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
	<head>
		<title>JavaScript Object-Oriented Inherited Lab2</title>
		<style type="text/css">
			div#header {
				color: #0066FF;
				font-size: 25pt;
			}
			
			div#content {
				color: #B088FF;
				font-size: 12pt;
			}
		</style>
		
		<!-- embed jquery by google，藉由google嵌入jquery 1.4.4 -->
		<script type="text/javascript" src="http://www.google.com/jsapi"></script>
		<script type="text/javascript" language="javascript">
			google.load( "jquery", "1.4.4" );
		</script>
		<script type="text/javascript">
			$( document ).ready( function() {
			
				// 定義、宣告一個function實體
				var Employee = function( name, age ) {
					this.name = name;
					this.age = age;
					this.companyName = "Systemweb";
				};
				
				Employee.prototype.talk = function() {
					alert( 
						"employee name is " + this.name + "\n" +
						"employee age is " + this.age + "\n" +
						"company name is " + this.companyName
					);
				};
				
				var employee = new Employee( "Peter", "30" );
				employee.talk();
				
				var employee2 = new Employee( "Mia", "21" );
				employee2.talk();
				
				Employee.prototype.car = {
					firstCar: "Benz",
					secondCar: "BMW",
					thirdCar: "Toyota"
				};
				
				var a = new Employee( "Kelly", "24" );
				alert(
					"a.car.firstCar: " + a.car.firstCar + "\n" + 
					"a.car.secondCar: " + a.car.secondCar + "\n" + 
					"a.car.thirdCar: " + a.car.thirdCar
				);
			});
		</script>
		
	</head>
	
	<body>
		<div title="temp1" id="header">Hello HTML</div>
		<div title="temp1" id="content">Here is content</div>
	</body>
</html>